package start;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        /*AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        A myA = context.getBean(A.class);*/
        
        //4.12.2.2 Building the container programmatically using register(Class<?>...)
        /*AnnotationConfigApplicationContext context2 = new AnnotationConfigApplicationContext();
        context2.register(AppConfig2.class);
        context2.register(AppConfig3.class);
        context2.refresh();*/
        
        //4.12.2.3 Enabling component scanning with scan(String...)
        /*AnnotationConfigApplicationContext context3 = new AnnotationConfigApplicationContext();
        context3.scan("start");
        context3.refresh();
        A myA = context3.getBean(A.class);*/
        
        //4.12.3.1 Using the @Import annotation
        //AnnotationConfigApplicationContext context4 = new AnnotationConfigApplicationContext(AppConfigA.class);
        //A myA = context4.getBean(A.class);
        //DataSource ds = context4.getBean(DataSource.class);
        
        //4.12.4.1 Declaring a bean
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfigC.class);
        A myA = (A) context.getBean("aBean");
        A myA2 = (A) context.getBean("aBean");
        
    }
}